Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #499 +/- ##
===========================================
+ Coverage 43.97% 85.59% +41.61%
===========================================
Files 85 96 +11
Lines 7281 9379 +2098
===========================================
+ Hits 3202 8028 +4826
+ Misses 4079 1351 -2728 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for this, @ShryukGrandhi. The change is small and the approach is sound: 1. Silent behaviour change for
2. 3. Tests
4. 5. Minor
Summary: the approach is good and I'd merge it after point 1 (docs or seed option plus a breaking-change note) and the CI coverage in point 3. Points 2 and 4 can be follow-ups. cc @Mec-iS |
smartcorelib#416) Add make_blobs_with_seed, make_circles_with_seed and make_moons_with_seed. Document the std_rand dependency of the generator output, label the CHANGELOG entry as breaking, test the std_rand randomness, and write TemporaryTextFile into the OS temporary directory. Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
|
Re-reviewed after the latest changes (
All 13 checks pass on the current head (lint, MSRV 1.85, Remaining points, none blocking:
Approving from my side once the maintainers are happy with point 4. cc @Mec-iS |
…ANGELOG (smartcorelib#416) Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
Fixes #416
Checklist
Current behaviour
The
datasetsfeature enablesstd_rand. The embedded toy datasets (iris, boston, digits, ...) do not use an RNG. But the generators indataset/generator.rs(make_blobs,make_circles,make_moons) callrand::rng(), which exists only withrand/thread_rng. If you removestd_randfromdatasets,cargo build --no-default-features --features datasetsfails withcannot find function rng in crate rand. The test helperreaders/io_testing.rsalso callsrand::rng()to make temporary file names, socargo test --features datasetscannot compile withoutstd_rand.New expected behaviour
Cargo.toml:datasets = ["serde"].rand_custom::get_rng_impl(None), like the other modules in the crate. Withstd_rand, the RNG takes its seed from OS entropy, so the output stays random as before. Withoutstd_rand, the RNG isSmallRngwith a fixed seed (orgetrandomwithjs), so the output is the same for each call.TemporaryTextFile(test-only) makes its file name from the process id and an atomic counter. It does not need an OS RNG.test_generators_without_std_rand_are_reproducible. It runs only whenstd_randandjsare off, and it checks that the generators compile and give reproducible output in that configuration.Change logs
Changed
datasetsfeature no longer enablesstd_rand. If you want non-deterministic generator output, enablestd_randtogether withdatasets. This is inCHANGELOG.md.Testing
cargo build --no-default-features --features datasets(failed before the fix, passes now)cargo test,cargo test --features datasets,cargo test --features datasets,std_rand,cargo test --all-features: all passcargo fmt --all -- --check,cargo clippy --all-features -- -Drust-2018-idioms -Dwarnings: clean